package castledefense.gui.upgradePanel;

import castledefense.gui.BuildingButton;
import castledefense.gui.UpgradePanel;
import castledefense.logic.Selectable;
import castledefense.logic.buildings.Building;
import castledefense.logic.buildings.Castle;
import castledefense.logic.units.Unit;
import de.matthiasmann.twl.Widget;

public class UpgradePanelDrawing {
	
	private BuildingButtonInfoPanel buildingButtonPanel2;
	private BuildingInfoPanel buildingInfoPanel;
	private CastleInfoPanel castleInfoPanel;
	private UnitInfoPanel unitInfoPanel;
	
	private Widget rootPane;
	
	public UpgradePanelDrawing(UpgradePanel panel) {
		
		rootPane = new Widget();
		rootPane.setTheme("");
		panel.add(rootPane);
		
		buildingButtonPanel2 = new BuildingButtonInfoPanel();
		buildingInfoPanel = new BuildingInfoPanel();
		castleInfoPanel = new CastleInfoPanel();
		unitInfoPanel = new UnitInfoPanel();
	}
	
	public void drawInfo(Selectable sel){
		if(sel instanceof BuildingButton){
			buildingButtonPanel2.draw((BuildingButton)sel, rootPane);
		}else if(sel instanceof Unit){
			unitInfoPanel.draw((Unit)sel, rootPane);
		}else if(sel instanceof Castle){
			castleInfoPanel.draw((Castle)sel, rootPane);
		}else if(sel instanceof Building){
			buildingInfoPanel.draw((Building)sel, rootPane);
		}
	}

}
